//
//  NewFuLiTableViewCell.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/16.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewFuLiTableViewCell.h"
#import "JTCSM.h"

static CGFloat space = 20;
static CGFloat top = 20;

@interface NewFuLiTableViewCell()
{
    UIImageView *imageView;
    UILabel *titleLabel;
    CGFloat imageheight;
    CGFloat imagewidth;
    CellType mytype;
    
}
@end
@implementation NewFuLiTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier cellType:(CellType)type{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        mytype = type;
        imagewidth = (KSCREENWidth-4*space)/3;
        imageheight = imagewidth*160/208;
       CGFloat bigImageHeight = imagewidth*175/208;
        if (type == ThreeType) {
            imageView = [[UIImageView alloc]initWithFrame:CGRectMake(space, 10, KSCREENWidth-2*space, 90)];
            imageView.image = [UIImage imageNamed:@"item_welfare_iv1.png"];
            [self.contentView addSubview:imageView];
        }else{
            for (int i = 0; i <3; i++) {
                imageView = [[UIImageView alloc]initWithFrame:CGRectMake(space+(imagewidth+space)*i, (type==TwoType?bigImageHeight-imageheight:(i == 0?bigImageHeight-imageheight:0)), imagewidth, (type==TwoType?imageheight:i == 0 ? imageheight:bigImageHeight))];
                imageView.image = [UIImage imageNamed:@"爱要出说.png"];
                imageView.tag = 100+i;
                [self.contentView addSubview:imageView];
                if (type == TwoType) {
                    [df layerWithView:imageView radius:imageheight/2 width:0 color:nil];
                }
                
                titleLabel = [UILabel initWithFrame:CGRectMake(imageView.LC_x, KVIEW_Y(imageView)+5, imageView.LC_width, 20) text:@"123" font:12 textAlignment:NSTextAlignmentCenter texcolor:[df colorWithHexString:@"999999" alpha:1] backgroundColor:nil];
                titleLabel.tag = 200+i;
                [self.contentView addSubview:titleLabel];
                
            }
            [df lineViewWithHeightofTop:KVIEW_Y(titleLabel)+top superView:self.contentView spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
        }
        
        
    }
    return self;
}

- (void)setValueWithModel:(id)model{
    NSIndexPath *mypath = model;
    NSArray *titleArray;
    NSArray *imageArray;
    if (mypath.section == 0) {
       titleArray = @[@"转入",@"排行榜",@"实物"];
        imageArray = @[@"activity_welfare_iv1.png",@"activity_welfare_iv2.png",@"activity_welfare_iv3.png"];
    }else if (mypath.section == 1) {
        titleArray = @[@"牵手过情人节",@"来一瓶腊八粥",@"粽情浓端午"];
        imageArray = @[@"爱要出说来.png",@"爱要出说来.png",@"爱要出说来.png"];
    }
    for (int i = 200; i<203; i++) {
        UILabel *label = [self.contentView viewWithTag:i];
        label.text = titleArray[i-200];
        UIImageView *one = [self.contentView viewWithTag:i-100];
        one.image = [UIImage imageNamed:imageArray[i-200]];
    }
    
}

+ (CGFloat)DefualtgetcellHeight{
   CGFloat myimageheight = (KSCREENWidth-4*space)/3*175/208;
    CGFloat height = myimageheight+35;
    return height;
}

+ (CGFloat)TypeCellgetcellHeight{
    CGFloat height = 100;
    return height;
}

@end
